package WordCount;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

// map阶段
// KEYIN: 输入数据的key的类型
// VALUEIN: 输入数据的value的类型
// KEYOUT: 输出数据的key的类型
// VALUEOUT: 输出数据的value的类型
public class WordCountMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
    private final static IntWritable valutOut = new IntWritable(1);
    private Text keyOut = new Text();
    private static String[] info;
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        info=value.toString().split(",");
            keyOut.set(info[9]);
            context.write(keyOut, valutOut);
    }
}
